package com.huage_06.cookie;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeTest {
    public static void main(String[] args) throws ParseException {
        //获取当前时间戳
        Date date = new Date();
        long t = date.getTime();
        System.out.println(t);
        //时间戳格式化 time=1615904362590; Idea-36163a6c=0255514f-848d-47f3-bab7-0bf95e0467fe;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time= df.format(1615904362590L);
        System.out.println(time);
    }
}
